package com.lucene.test.pojo;

import com.lucene.test.annotate.LuceneField;
import lombok.*;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;

import java.io.Serializable;

/**
 * 索引基类
 * @author zoumy9
 * @date 2024/05/23 16:27
 **/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class BaseIndexEntity implements Serializable {
    /**
     * 唯一的业务主键
     * 要求实现按照 id 检索和 按照 id 升降序排序
     */
    @LuceneField(name = "id", stored = Field.Store.YES)
    private Long id;
    /**
     * 标题
     * 要求实现模糊匹配
     */
    @LuceneField(name = "title", fieldClazz = {TextField.class}, stored = Field.Store.YES)
    private String title;

    /**
     * 状态码
     * 要求实现多值匹配，及 status in (status1, ... statusn)
     */
    @LuceneField(name = "status", stored = Field.Store.YES)
    private String status;
    /**
     * 创建更新时间
     * 要求实现范围匹配，及 time >= start_time and time <= end_time
     */
    @LuceneField(name = "status", fieldClazz = {LongPoint.class, StringField.class}, stored = Field.Store.YES)
    private Long time;

}
